package org.myOrg.spetrum.GUI;

import java.awt.Color;

import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyleContext;

public class StyleSet {
	private static Style StyleNormal ;
	private static Style StyleFailed ;
    private static Style StylePassed ;
    private static Style StyleTitle;
    private static Style StyleConsleRight;
    private static Style StyleConsleWrong;
    private static Style StyleMode;

	/**
	 * 
	 * @return the fontNormal
	 */
	public static Style getStyleNormal() {
		if (StyleNormal == null) {
			StyleNormal = getNormalStyle();
		}
		return StyleNormal;
	}

	/**
	 * @return the fontFailed
	 */
	public static Style getStyleFailed() {
		if (StyleFailed == null) {
			StyleFailed = getNormalStyle();
			StyleConstants.setForeground(StyleFailed, Color.red.darker());
		}
		return StyleFailed;
	}

	/**
	 * @return the stylePassed
	 */
	public static Style getStylePassed() {
		if (StylePassed == null) {
			StylePassed = getNormalStyle();
			StyleConstants.setForeground(StylePassed, Color.green.darker());
		}
		return StylePassed;
	}
	
	public static Style getStyleTitle(){
		if(StyleTitle == null){
			StyleTitle =  getNormalStyle();
			StyleConstants.setBold(StyleTitle, false);
			StyleConstants.setItalic(StyleTitle, true);
		}
		return StyleTitle;
	}
	
	public static Style getStyleConsleRight(){
		if(StyleConsleRight == null){
			StyleConsleRight =  getNormalStyle();
			StyleConstants.setBold(StyleConsleRight, false);
			StyleConstants.setForeground(StyleConsleRight, Color.blue.darker());
			
		}
		return StyleConsleRight;
	}
	
	public static Style getStyleConsleWrong(){
		if(StyleConsleWrong == null){
			StyleConsleWrong =  getNormalStyle();
			StyleConstants.setBold(StyleConsleWrong, false);
			StyleConstants.setForeground(StyleConsleWrong, Color.red);
			
		}
		return StyleConsleWrong;
	}
	
	public static Style getStyleMode(){
		if(StyleMode == null){
			StyleMode =  getNormalStyle();
			StyleConstants.setBold(StyleMode, false);
			StyleConstants.setForeground(StyleMode, Color.orange.darker());
			StyleConstants.setBold(StyleMode, true);
			
		}
		return StyleMode;
	}

	private static Style getNormalStyle() {
		Style StyleNormal = new StyleContext().new NamedStyle();
		StyleConstants.setFontSize(StyleNormal, 14);
		StyleConstants.setLineSpacing(StyleNormal, 1.2f);
		StyleConstants.setBold(StyleNormal, true);
		return StyleNormal;
	}
}
